package com.woniu.mapper;

import com.woniu.pojo.Subject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniu.vo.TreeSubjectVO;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 课程科目 Mapper 接口
 * </p>
 *
 * @author xiaoruan
 * @since 2023-03-14
 */
public interface SubjectMapper extends BaseMapper<Subject> {

    @Select("select * from wnxt_subject where parent_id='0' and title=#{subjectOne}")
    Subject selectOneSubject(String subjectOne);

    @Select("select * from wnxt_subject where parent_id=#{id} and title=#{SubjectTwo}")
    Subject selectTwoSubject(String id, String SubjectTwo);


    @Select("select id,title from wnxt_subject where parent_id=#{s}")
    @ResultType(TreeSubjectVO.class)
    List<TreeSubjectVO> listByParentId(String s);

    @Select("select id,title,parent_id from wnxt_subject")
    @ResultType(TreeSubjectVO.class)
    List<TreeSubjectVO> selectAll();

    @Select("select * from wnxt_subject where parent_id=#{s}")
    @ResultType(TreeSubjectVO.class)
    List<Subject> listByParentIdPlus(String s);

    @Select("select * from wnxt_subject where parent_id != '0'")
    List<Subject> listbyParentId();
}
